<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head></head>
<body>

<nav th:replace="layouts::navbar"></nav>

<div class="container">
    <form th:action="@{/students/save}"  th:object="${student}"  method="POST">
        <!--        用于更新学生信息时获取被点击的学生的ID-->

        <input type="hidden" th:field="${student.studentId}">
        <div class="form-group">
            <div class="col-sm-6">
                <input type="text" placeholder="姓名" th:field="${student.name}">
                <span th:if="${#fields.hasErrors('name')}" th:errors="${student.name}"></span>
            </div>
        </div>
        <br>
        <div class="form-group">
            <div class="col-sm-6">
                <input type="text" placeholder="手机号码" th:field="${student.phone}">
                <span th:if="${#fields.hasErrors('phone')}" th:errors="${student.phone}"></span>
            </div>
        </div>
        <br>
        <div class="form-group">
            <div class="col-sm-6">
                <input type="text" placeholder="性别" th:field="${student.sex}">
                <span th:if="${#fields.hasErrors('sex')}" th:errors="${student.sex}"></span>
            </div>
        </div>
        <br>

        <button  class="btn btn-info" type="submit">新建学生</button>
    </form>
</div>
</body>
</html>